<template>
  <div>
    <FilterTable
      ref="table"
      columnsRef="ygy_additionalProject"
      :columns="columns"
      height="auto"
      :dataSource="list"
      :isSelectColumn="false"
      :onColumnsChange="columns => (this.columns = columns)"
    ></FilterTable>
  </div>
</template> 

<script>
import { dictionary } from '@/utils/dictMixin';
import { getAllRepairAddItem } from '@/api/repair/repairManage/repairQuery';

export default {
  name: 'additionalProject',
  components: {},
  mixins: [dictionary],
  props: {
    roItemsProject: {
      type: Array,
      default: () => []
    },
  },
  data() {
    return {
      columns: this.createTableColumns(),
      list: [],
      roItems:{},
      fetchParams: {}
    };
  },
  created() {
    let roNo = this.roNo;
  },
  mounted() {
    //this.columns.find(x => x.dataIndex === 'chargePartitionCode').dictItems = this.chargePartition;
    this.$refs.table.SET_TABLE_DATA(this.roItemsProject);
    this.queryAdditionaItem();
  },
  methods: {
    createTableColumns() {
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 50,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '收费区分',
          dataIndex: 'accountTypeName',
          sorter: true,
          dictItems: []
        },
        {
          title: '附加项目代码',
          dataIndex: 'addItemCode',
          minWidth: 120,
          sorter: true,
          showOverflowTooltip: true
        },
        {
          title: '附加项目名称',
          dataIndex: 'addItemName',
          minWidth: 120,
          sorter: true,
          showOverflowTooltip: true
        },
        {
          title: '附加项目费',
          dataIndex: 'addItemAmount',
          minWidth: 110,
          sorter: true,
          showOverflowTooltip: true,
          precision: 2
        },
        // {
        //   title: '优惠金额',
        //   dataIndex: 'preferentialAmount',
        //   minWidth: 100,
        //   sorter: true,
        //   showOverflowTooltip: true,
        //   numberFormat: true
        // },
        // {
        //   title: '折扣率',
        //   dataIndex: 'discount',
        //   minWidth: 90,
        //   sorter: true,
        //   showOverflowTooltip: true,
        //   editable: false,
        //   defaultEditable: true,
        //   editType: 'input'
        // },
        // {
        //   title: '实收金额',
        //   dataIndex: 'receiveAmount',
        //   minWidth: 100,
        //   sorter: true,
        //   showOverflowTooltip: true,
        //   numberFormat: true
        // }
      ];
    },
    // async getDetail(){
    // const detailMap = await getAllRepairLabour();
    // if(detailMap.resultCode === 200){
    // this.roItems = detailMap.roItems;
    // console.log(JSON.stringify(this.roItems)+"this.detailMap++++++++++++++++++++++++++")
    // return this.roItems;
    // }
    // },

    // 附加材料查询
    async queryAdditionaItem() {
      console.log(JSON.stringify(this.roItemsProject)+"++++++++++++++++++++++++++++++++++++")
      // const roNo = this.roNo;
      // const res = (await addItem(roNo)).data.rows;
      // this.list = res;
    }
  }
};
</script>

<style lang="less"></style>
